/******************************************************************************
 * RLT DSP
 * by Roberto Bender <beto.bender@gmail.com>
 * under GPL 2.0 license
 * 2009
******************************************************************************/

#include "distortion.h"
#include "defines.h"
#include <math.h>
#include <stdio.h>

extern inputWord m_Silence;

workingWord harmonic(workingWord input, struct FilterParams* params)
{
    static int count = 0;
    return   
    ( 
            (WORD_MAX / 2) * sin( (count++ * M_PI * 440.0) / SAMPLE_FREQUENCY )
            //+ (WORD_MAX / 2) * sin( (count++ * M_PI * 330.0) / SAMPLE_FREQUENCY )
    );
    
    /*static int count = 0;
    static int above = 0;
    const int amp = 3000;
    const float time = (float)BUFFER_SIZE / (float)SAMPLE_FREQUENCY;
    
    if(count > BUFFER_SIZE)
    {
        printf("Calculated: above(%d), freq(%f)\n", above, time * above/2.0 * (float)SAMPLE_FREQUENCY);
    
    
        count = 0;
        above = 0;
    }
    else
    {
        ++count;
        if(input - m_Silence > amp || input - m_Silence < -amp)
            ++above;
    }
    
    return input;*/
}
